<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath =
            request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                    + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <title>房屋租赁系统</title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="js/libs/modernizr.min.js"></script>
    <style type="text/css">

    </style>
    <script type="text/javascript">
        var error = "${param.error}";
        if (error == "deletesuccess") {
            alert("删除成功！");
        }

    </script>
</head>
<body>
<div>
    <div class="result-title">
        <c:choose>
            <c:when test="${type=='zuke'}"><h1>租客资料管理</h1></c:when>
            <c:when test="${type=='fangdong'}"><h1>业主资料管理</h1></c:when>
        </c:choose>

    </div>
    <form id="houseForm" name="houseForm"
          action="findalluserlist.action"
          method=post>
        <div class="result-title">
            <div class="result-list">


            </div>
        </div>

        <div class="result-content">
            <table id=grid
                   class="result-tab" width="100%">
                <tbody>
                <c:choose>
                    <c:when test="${type=='zuke'}">
                        <tr style="FONT-WEIGHT: bold; FONT-STYLE: normal; BACKGROUND-COLOR: #eeeeee; TEXT-DECORATION: none">
                            <td style="width:20%">租客用户名</td>
                            <td style="width:20%">租客姓名</td>
                            <td style="width:20%">租客身份证号码</td>
                            <td style="width:20%">租客联系电话</td>
                            <td style="width:20%">操作</td>
                        </tr>
                    </c:when>
                    <c:when test="${type=='fangdong'}">
                        <tr style="FONT-WEIGHT: bold; FONT-STYLE: normal; BACKGROUND-COLOR: #eeeeee; TEXT-DECORATION: none">
                            <td style="width:20%">房东用户名</td>
                            <td style="width:20%">房东姓名</td>
                            <td style="width:20%">房东身份证号码</td>
                            <td style="width:20%">房东联系电话</td>
                            <td style="width:20%">操作</td>
                        </tr>
                    </c:when>
                </c:choose>

                <c:forEach items="${userlist}" var="userlist">
                    <tr
                            style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">
                        <td>${userlist.user.username}</td>

                        <td>${userlist.name}</td>
                        <td>${userlist.idcard}</td>
                        <td>${userlist.phone}</td>

                        <td>

                            <a class="link-update"
                               href="deleteuserlist.action?id=${userlist.user.id}"
                               onclick="return window.confirm('确定删除吗？')">删除</a>


                        </td>


                    </tr>

                </c:forEach>

                </tbody>
            </table>
        </div>


        <tr>
        <tr>
							<span id=pagelink>
								<div style="LINE-HEIGHT: 20px; HEIGHT: 20px; TEXT-ALIGN: right; margin-top:10px">
									共[<B>${p.total}</B>]条记录，共[<B>${p.pages}</B>]页
									,

									<c:if test="${ p.pageNum > 1 }">
                                        [<A href="javascript:to_page(${p.prePage})">前一页</A>]
                                    </c:if>
										<input type="hidden" name="page" id="page" value=""/>
									第<B>${p.pageNum}</B>页

									<c:if test="${ p.pageNum < p.pages }">
                                        [<A href="javascript:to_page(${p.nextPage})">后一页</A>]
                                    </c:if>

									
								</div>
							</span>

        </tr>
        </tbody>


        </tbody>


    </form>
</div>
<script language=javascript>
    // 提交分页的查询的表单
    function to_page(page) {
        if (page) {
            $("#page").val(page);
        }
        document.houseForm.submit();
    }
</script>
</body>
</html>